package com.jtcoding.chat.controller;

import com.jtcoding.chat.model.Chat;
import com.jtcoding.chat.model.ChatDetail;
import com.jtcoding.chat.model.ChatRecord;
import com.jtcoding.chat.model.Result;
import com.jtcoding.chat.service.ChatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author jason.tang
 * @Date 2019/02/4 14:13
 * @Desc 聊天控制器
 */
@Api(tags = "聊天相关")
@RestController
@RequestMapping("/chats")
public class ChatController {

    @Autowired
    private ChatService chatService;

    @ApiOperation(value = "获取用户聊天列表", notes = "获取用户当前聊天列表")
    @GetMapping("/{userNum}")
    public Result<List<ChatDetail>> getChatListByNum(@PathVariable Integer userNum) {
        return Result.success(chatService.getChatListByNum(userNum));
    }
}
